feat(automation): script-node outputVariable + interpolated inputs (pure-function pattern, #1870)#1926
Merged
Merged
Conversation
…ure-function pattern, #1870) Long-term design for flow functions (per the templates evaluation): a flow `function` is a PURE compute step — inputs → return value — and ALL data I/O stays declarative on the flow graph. This keeps the data layer visible, governed (RLS/tenancy/transactions via the engine's data path), and build-checkable (create/update_record nodes the build already validates) — rather than giving functions a raw data API that hides writes and bypasses governance. (Data- lifecycle side effects remain L2 hooks, which legitimately get ctx.api.) Two enablers: - `config.outputVariable` exposes the function's return value as a flow variable → a later update_record persists it (`fields: { ai_category: '{ai.ai_category}' }`). - `config.inputs` are now interpolated against live flow variables, so a function can consume a prior node's output (`inputs: { ticketId: '{record.id}' }`). Skill: automation pitfall #9 now teaches the pure-function pattern (function returns → outputVariable → update_record; hooks for data side effects). +1 end-to-end test (compute → outputVariable → downstream node interpolates it); service-automation 202; check:skill-docs passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 5 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The long-term design for flow functions, decided from the templates evaluation. A flow
function(script node) is a pure compute step — and ALL data I/O stays declarative on the flow graph.Why pure-function (not a data API on the function)
The AI templates wrote
invoke_functionexpecting the function to update the record directly, but flow functions getFlowFunctionContext(input/variables/automation/logger) — no data API, by design. That boundary is correct for a metadata-first, AI-authored platform:update_record), not hidden in code.objectstack build; opaque function I/O is exactly the "passes build / fails at runtime" class this season fought.ctx.api); flow functions are orchestration compute.So the fix makes the pure-function pattern ergonomic, not the imperative one work.
What's added
config.outputVariable— exposes the function's return value as a flow variable, so a later declarative node persists it.config.inputsare interpolated against live flow variables (they were passed raw) — so a function can consume a prior node's output.Also
{ai.field});@objectstack/service-automation202 pass;check:skill-docspasses.This is the framework foundation for the templates' #1870 remediation (restructure the 4 AI flows to function-returns + update_record).
🤖 Generated with Claude Code